<html>
<head><meta charset="utf-8"><title>padding bytes def #183 · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html">padding bytes def #183</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="172119226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172119226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172119226">(Jul 31 2019 at 11:38)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I am not sure how your typed copy proposal can be reconciled with how memcpy works today:</p>



<a name="172119352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172119352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172119352">(Jul 31 2019 at 11:41)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="n">from</span>: <span class="nc">T</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">valid</span><span class="p">;</span><span class="w"></span>
<span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">to</span>: <span class="nc">T</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">uninitialized</span><span class="p">;</span><span class="w"></span>
<span class="n">memcpy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">to</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">..</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="o">*</span><span class="k">const</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">from</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="o">*</span><span class="k">mut</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="n">size_of</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">());</span><span class="w"></span>
</pre></div>


<p>Here <code>memcpy</code> only works on a <code>[u8]</code> so IIUC per your typed copy proposal, all bytes of T including padding bytes should be copied. Yet right now this is not the case.</p>



<a name="172119362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172119362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172119362">(Jul 31 2019 at 11:41)</a>:</h4>
<p>(deleted)</p>



<a name="172119533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172119533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172119533">(Jul 31 2019 at 11:44)</a>:</h4>
<p>To make <code>memcpy</code> work in your proposal, it would need to operate on <code>*T</code> and not on <code>*u8</code></p>



<a name="172119609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172119609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172119609">(Jul 31 2019 at 11:45)</a>:</h4>
<p>The implementation of our <code>memcpy</code> is here: <a href="https://github.com/rust-lang-nursery/compiler-builtins/blob/6178e2c61105a9ff7fa1c4fc974b142b0c07ae3d/src/mem.rs#L9" target="_blank" title="https://github.com/rust-lang-nursery/compiler-builtins/blob/6178e2c61105a9ff7fa1c4fc974b142b0c07ae3d/src/mem.rs#L9">https://github.com/rust-lang-nursery/compiler-builtins/blob/6178e2c61105a9ff7fa1c4fc974b142b0c07ae3d/src/mem.rs#L9</a></p>
<p>And as you see the code there is written to copy all bytes, so it must copy padding bytes, but it can be optimized not to do that, and it is currently optimized as such.</p>



<a name="172120274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172120274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172120274">(Jul 31 2019 at 11:57)</a>:</h4>
<p>I don't <em>not</em> believe it, but could you please demonstrate a concrete program using <code>memcpy</code> which is optimized to not copy padding?</p>



<a name="172120670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172120670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172120670">(Jul 31 2019 at 12:04)</a>:</h4>
<p>uh</p>



<a name="172120681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172120681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172120681">(Jul 31 2019 at 12:04)</a>:</h4>
<p><a href="https://rust.godbolt.org/z/_Oha1o" target="_blank" title="https://rust.godbolt.org/z/_Oha1o">https://rust.godbolt.org/z/_Oha1o</a></p>



<a name="172120688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172120688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172120688">(Jul 31 2019 at 12:04)</a>:</h4>
<p>we don't, but then, it is a compiler bug</p>



<a name="172120808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172120808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172120808">(Jul 31 2019 at 12:06)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> <a href="https://rust.godbolt.org/z/SDb-pj" target="_blank" title="https://rust.godbolt.org/z/SDb-pj">https://rust.godbolt.org/z/SDb-pj</a> those two operations should only copy one byte, and not 128 bytes</p>



<a name="172121096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121096">(Jul 31 2019 at 12:10)</a>:</h4>
<p>Is that a compiler bug? Really? It seems to respect the quite reasonable semantics Ralf proposed, that's a good thing in my book.</p>



<a name="172121142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121142">(Jul 31 2019 at 12:11)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/63159" target="_blank" title="https://github.com/rust-lang/rust/issues/63159">https://github.com/rust-lang/rust/issues/63159</a></p>



<a name="172121146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121146">(Jul 31 2019 at 12:11)</a>:</h4>
<p>I consider it a missed optimization</p>



<a name="172121158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121158">(Jul 31 2019 at 12:12)</a>:</h4>
<p>The memcpy one I mean. ptr::copy_nonoverlapping could be considered a typed copy, so it should be optimizable. But plain <code>memcpy</code> being just that and not magically knowing about padding is a good thing IMO</p>



<a name="172121203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121203">(Jul 31 2019 at 12:12)</a>:</h4>
<p>The semantics ralf proposed do say that when doing a typed copy the padding bytes do not need to be copied</p>



<a name="172121243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121243">(Jul 31 2019 at 12:13)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> <code>ptr::copy_nonoverlapping</code> is the API of <code>memcpy</code> in Rust: <a href="https://rust.godbolt.org/z/rEG68z" target="_blank" title="https://rust.godbolt.org/z/rEG68z">https://rust.godbolt.org/z/rEG68z</a></p>



<a name="172121255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121255">(Jul 31 2019 at 12:13)</a>:</h4>
<p>(or at least is the only way I know to call the definition given in compiler-builtins)</p>



<a name="172121333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121333">(Jul 31 2019 at 12:14)</a>:</h4>
<p>I know what it lowers to, but it's a typed API and an intrinsic, so we can give it "typed copy" semantics while clearly making raw <code>memcpy</code> know about padding would require some ugly magic.</p>



<a name="172121366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121366">(Jul 31 2019 at 12:14)</a>:</h4>
<p>btw, LLVM will recognize calls to <code>extern "C" { fn memcpy(...); }</code> as The Memcpy Function and convert calls to it to <code>llvm.memcpy</code> intrinsics</p>



<a name="172121538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121538">(Jul 31 2019 at 12:17)</a>:</h4>
<p>Both of your examples are (in the first case) or could be (in the second case) typed copies so I don't really see the contradiction to Ralf's semantics. That's all I'm saying.</p>



<a name="172121542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121542">(Jul 31 2019 at 12:17)</a>:</h4>
<p>In C: <a href="https://rust.godbolt.org/z/Ka2VLG" target="_blank" title="https://rust.godbolt.org/z/Ka2VLG">https://rust.godbolt.org/z/Ka2VLG</a></p>



<a name="172121614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121614">(Jul 31 2019 at 12:18)</a>:</h4>
<p>lol</p>



<a name="172121616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121616">(Jul 31 2019 at 12:18)</a>:</h4>
<p>in Rust, using <code>extern "C" { fn memcpy(...); }</code> does not recognize the intrinsic as a <code>memcpy</code> function, so I'd guess that's another bug</p>



<a name="172121627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121627">(Jul 31 2019 at 12:18)</a>:</h4>
<p>huh</p>



<a name="172121628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121628">(Jul 31 2019 at 12:18)</a>:</h4>
<p>(note that in C both Clang and GCC do the optimization)</p>



<a name="172121655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121655">(Jul 31 2019 at 12:18)</a>:</h4>
<p>In Rust with <code>extern "C"</code> another missed optimization: <a href="https://rust.godbolt.org/z/O9Lrqw" target="_blank" title="https://rust.godbolt.org/z/O9Lrqw">https://rust.godbolt.org/z/O9Lrqw</a></p>



<a name="172121751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121751">(Jul 31 2019 at 12:20)</a>:</h4>
<p>Actually, I'm not sure if the <code>extern "C"</code> call in Rust is a missed optimization, it is definetely an optimization that C and C++ do, but since we have <code>ptr::copy_nonoverlapping</code> and C and C++ do not have it, I do not really care that much about <code>extern "C"</code></p>



<a name="172121768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121768">(Jul 31 2019 at 12:20)</a>:</h4>
<p>although it would at least be nice to have an attribute that the <code>libc</code> crate could use on the <code>memcpy</code> and <code>memmove</code> intrinsics that it exposes</p>



<a name="172121784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121784">(Jul 31 2019 at 12:20)</a>:</h4>
<p>but that's a problem that the libc crate has, and can be solved using unstable attributes</p>



<a name="172121896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172121896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172121896">(Jul 31 2019 at 12:23)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> I am not sure how your typed copy proposal can be reconciled with how memcpy works today:</p>
</blockquote>
<p>Anyway, do you agree that this issue <span aria-label="up" class="emoji emoji-2b06" role="img" title="up">:up:</span> is not an issue after all?</p>



<a name="172123774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172123774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172123774">(Jul 31 2019 at 12:51)</a>:</h4>
<p>yes, thanks, talking with you helped</p>



<a name="172146401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/172146401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#172146401">(Jul 31 2019 at 17:24)</a>:</h4>
<p>great, issue resolved before I even arrived in this thread :)</p>



<a name="173017760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173017760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173017760">(Aug 12 2019 at 12:10)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> a different way to define padding could be</p>



<a name="173017932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173017932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173017932">(Aug 12 2019 at 12:13)</a>:</h4>
<p>to just say that they have a particular type, like <code>MaybeUninit&lt;u8&gt;</code> ?</p>



<a name="173017951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173017951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173017951">(Aug 12 2019 at 12:13)</a>:</h4>
<p>e.g. <code>(u8, u16)</code> would just be <code>(u8, MaybeUninit&lt;u8&gt;, u16)</code></p>



<a name="173017958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173017958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173017958">(Aug 12 2019 at 12:13)</a>:</h4>
<p>and that the rules are the same ?</p>



<a name="173018007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018007">(Aug 12 2019 at 12:14)</a>:</h4>
<p>for initialization, we probably want to say that they are initialized to <code>MaybeUninit::uninit</code></p>



<a name="173018022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018022">(Aug 12 2019 at 12:14)</a>:</h4>
<p>The rules can't be the same. A <code>MaybeUninit&lt;u8&gt;</code> field always has to be copied, but by other (more conventional) definitions they don't have to be copied.</p>



<a name="173018027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018027">(Aug 12 2019 at 12:14)</a>:</h4>
<p>yep</p>



<a name="173018036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018036">(Aug 12 2019 at 12:14)</a>:</h4>
<p>so what we need is <code>Uninit&lt;u8&gt;</code> instead, which is always uninitialized</p>



<a name="173018051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018051">(Aug 12 2019 at 12:15)</a>:</h4>
<p>and therefore never needs to be copied</p>



<a name="173018055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018055">(Aug 12 2019 at 12:15)</a>:</h4>
<p>(or some other type like that)</p>



<a name="173018069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018069">(Aug 12 2019 at 12:15)</a>:</h4>
<p>"always uninitialized" is still a very weird notion as discussion elsewhere previously</p>



<a name="173018116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018116">(Aug 12 2019 at 12:16)</a>:</h4>
<p>these are always initialized, but they only have one valid representation, and that's 0xUU</p>



<a name="173018149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018149">(Aug 12 2019 at 12:16)</a>:</h4>
<p>That can't work out, it's allowed to write to padding, it just doesn't get preserved on typed copies. If 0xUU was the only valid bit string then e.g. <code>memset</code> followed by a typed copy would be UB.</p>



<a name="173018158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018158">(Aug 12 2019 at 12:16)</a>:</h4>
<p>indeed</p>



<a name="173018247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018247">(Aug 12 2019 at 12:18)</a>:</h4>
<p>bad idea - if we make it a normal type, then typed copies would need to copy it</p>



<a name="173018248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018248">(Aug 12 2019 at 12:18)</a>:</h4>
<p>I also don't see the motivation for trying to explicitly define padding this way (or in any other explicit way) when it can fall out nicely as a side effect of other definitions (repr relation)</p>



<a name="173018272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018272">(Aug 12 2019 at 12:19)</a>:</h4>
<p>i'm not sure how to differentiate padding from niche in the repr relation</p>



<a name="173018353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018353">(Aug 12 2019 at 12:20)</a>:</h4>
<p>for padding everything is valid, while niches are a sub-set of invalid relations</p>



<a name="173018369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173018369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173018369">(Aug 12 2019 at 12:21)</a>:</h4>
<p>Niches aren't ignored by the repr relation, padding is. e.g. is a byte can only be 0x00 or 0x01 for the byte list to represent a value of T, then there's a (potential) niche there. If the value of the byte is completely irrelevant for the value being represented, then it's padding.</p>



<a name="173030525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173030525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173030525">(Aug 12 2019 at 14:56)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> so a <code>u16</code> that can only be 0 or 1, has a niche</p>



<a name="173030536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173030536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173030536">(Aug 12 2019 at 14:56)</a>:</h4>
<p>and has no padding (the upper bytes must always be zero)</p>



<a name="173030667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173030667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173030667">(Aug 12 2019 at 14:58)</a>:</h4>
<p>if one wanted to say that the upper byte doesn't matter for the value representation, one could do <code>#[repr(align(2))] struct S(bool);</code> instead</p>



<a name="173031068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031068">(Aug 12 2019 at 15:02)</a>:</h4>
<p>but then one can't put that type at an alignment of 1</p>



<a name="173031168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031168">(Aug 12 2019 at 15:04)</a>:</h4>
<p>AFAICT one can't easily construct such a value with an alignment of 1</p>



<a name="173031434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031434">(Aug 12 2019 at 15:06)</a>:</h4>
<p>so I was wondering if there was a way to have a <code>Padding</code> type that one could use to explicitly add padding, and enable that</p>



<a name="173031449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031449">(Aug 12 2019 at 15:06)</a>:</h4>
<p>Such a type would be useful for <code>repr(C)</code></p>



<a name="173031614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031614">(Aug 12 2019 at 15:09)</a>:</h4>
<p>The problem I see is that for typed copies of the type to not copy anything it would need to have size 0, but then it cannot increase the size of the type</p>



<a name="173031656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031656">(Aug 12 2019 at 15:09)</a>:</h4>
<p>We currently use, e.g., <code>[...; 0]</code> types to insert padding to raise the alignment of the next field</p>



<a name="173031755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031755">(Aug 12 2019 at 15:10)</a>:</h4>
<p>but that's more implicit and hard to discover than just inserting a Padding field</p>



<a name="173031940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031940">(Aug 12 2019 at 15:12)</a>:</h4>
<p>such a Padding type would have non-zero size, but none of its bytes would be part of the value it represents</p>



<a name="173031991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173031991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173031991">(Aug 12 2019 at 15:12)</a>:</h4>
<p>it represents no value</p>



<a name="173040302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173040302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173040302">(Aug 12 2019 at 17:00)</a>:</h4>
<p>(more like it would only represent a single value, like <code>()</code>)</p>



<a name="173044945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173044945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173044945">(Aug 12 2019 at 17:56)</a>:</h4>
<blockquote>
<p>i'm not sure how to differentiate padding from niche in the repr relation</p>
</blockquote>
<p>what is the problem?<br>
niche: byte lists that are not valid for any value<br>
padding: bytes that you can change arbitrarily without affecting the value for which the overall byte list is valid</p>



<a name="173047347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047347">(Aug 12 2019 at 18:26)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> is padding the fundamental primitive ?</p>



<a name="173047501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047501">(Aug 12 2019 at 18:28)</a>:</h4>
<p>i mean, we have bytes, and then we have padding bytes, which are not like normal bytes</p>



<a name="173047555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047555">(Aug 12 2019 at 18:29)</a>:</h4>
<p>no, they are not fundamental in any way</p>



<a name="173047627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047627">(Aug 12 2019 at 18:30)</a>:</h4>
<p>whats fundamental is the value relation</p>



<a name="173047636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047636">(Aug 12 2019 at 18:30)</a>:</h4>
<p>this is all following what I laid down in <a href="https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/value-domain.md" target="_blank" title="https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/value-domain.md">https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/value-domain.md</a></p>



<a name="173047656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047656">(Aug 12 2019 at 18:30)</a>:</h4>
<p>and bytes that do not affect it follow from it</p>



<a name="173047661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047661">(Aug 12 2019 at 18:30)</a>:</h4>
<p>the notion of typed copy I describe there handles padding correctly, I think</p>



<a name="173047667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047667">(Aug 12 2019 at 18:30)</a>:</h4>
<p>and we just call them padding bytes</p>



<a name="173047695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047695">(Aug 12 2019 at 18:31)</a>:</h4>
<p>specifically, for a type like <code>(u8, u16)</code>, with abstract value say <code>Tuple([42, 1337])</code></p>



<a name="173047711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047711">(Aug 12 2019 at 18:31)</a>:</h4>
<p>it will, when writing, pick (non-deterministically) any value for the padding byte</p>



<a name="173047718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047718">(Aug 12 2019 at 18:31)</a>:</h4>
<p>so it's not actually saying they become <code>0xUU</code>, it says they could become anything</p>



<a name="173047740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047740">(Aug 12 2019 at 18:31)</a>:</h4>
<p>but that is indistinguishable in the program from saying they become <code>0xUU</code></p>



<a name="173047834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047834">(Aug 12 2019 at 18:32)</a>:</h4>
<p>that is, it is not that only 0xUU is validfor padding</p>



<a name="173047844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047844">(Aug 12 2019 at 18:32)</a>:</h4>
<blockquote>
<p>it will, when writing, pick (non-deterministically) any value for the padding byte</p>
</blockquote>
<p>the reason for this is that no matter what the padding byte says, the resulting byte list is related to the abstract value we are writing</p>



<a name="173047862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047862">(Aug 12 2019 at 18:33)</a>:</h4>
<p><code>Tuple([0, 0])</code> is easier</p>



<a name="173047897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047897">(Aug 12 2019 at 18:33)</a>:</h4>
<p>the set of 4-byte lists related to that is the set consisting of all <code>[Raw(0), X, Raw(0), Raw(0)]</code> for any <code>X</code></p>



<a name="173047988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173047988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173047988">(Aug 12 2019 at 18:34)</a>:</h4>
<p>well technically the way I wrote it, it could also pick pointer bytes that, when cast to an int, produce 0... hm, interesting.^^ that is an orthogonal issue though.</p>



<a name="173050726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173050726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173050726">(Aug 12 2019 at 19:06)</a>:</h4>
<p>Is it important to be able to talk about <code>X</code> as if they are a special value that a byte can take ?</p>



<a name="173050774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173050774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173050774">(Aug 12 2019 at 19:07)</a>:</h4>
<p>we say today that a byte can be <code>{0..256, UU}</code>, but could we extend that to also say <code>{0..256, UU, X}</code> ?</p>



<a name="173050869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173050869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173050869">(Aug 12 2019 at 19:08)</a>:</h4>
<p>where X is "doesn't matter"</p>



<a name="173051470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173051470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173051470">(Aug 12 2019 at 19:16)</a>:</h4>
<blockquote>
<p>Is it important to be able to talk about <code>X</code> as if they are a special value that a byte can take ?</p>
</blockquote>
<p><code>X</code> is a mathematical variable here, quantifying over all values of my <code>Byte</code> type</p>



<a name="173051502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173051502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173051502">(Aug 12 2019 at 19:17)</a>:</h4>
<blockquote>
<p>where X is "doesn't matter"</p>
</blockquote>
<p>that seems like an unnecessary complication to me. I dont even see how it would behave differently from <code>UU</code></p>



<a name="173051523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173051523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173051523">(Aug 12 2019 at 19:17)</a>:</h4>
<blockquote>
<p>we say today that a byte can be <code>{0..256, UU}</code></p>
</blockquote>
<p>that's incomplete, it can also be a pointer fragment (carrying provenance)</p>



<a name="173115154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173115154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173115154">(Aug 13 2019 at 13:58)</a>:</h4>
<blockquote>
<p>that seems like an unnecessary complication to me. I dont even see how it would behave differently from UU</p>
</blockquote>
<p>I don't either</p>



<a name="173115174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173115174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173115174">(Aug 13 2019 at 13:58)</a>:</h4>
<p>yet we don't have a way to use <code>UU</code> in Rust like that</p>



<a name="173115180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173115180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173115180">(Aug 13 2019 at 13:58)</a>:</h4>
<p>right?</p>



<a name="173115220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173115220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173115220">(Aug 13 2019 at 13:59)</a>:</h4>
<p>e.g. <code>MaybeUninit&lt;u8&gt;</code> wouldn't be it, because it requires the byte to be copied</p>



<a name="173148795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173148795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173148795">(Aug 13 2019 at 20:31)</a>:</h4>
<blockquote>
<p>yet we don't have a way to use <code>UU</code> in Rust like that</p>
</blockquote>
<p>I don't follow. As I said above I believe I have fully described padding in my existing frame, the way I defined <code>Byte</code> and <code>Value</code> in my WIP documents. What do you think is missing from that?</p>



<a name="173198592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173198592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173198592">(Aug 14 2019 at 12:42)</a>:</h4>
<p>The ability for a user to say "at offset y there are N bytes of padding"</p>



<a name="173198622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173198622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173198622">(Aug 14 2019 at 12:42)</a>:</h4>
<p>Or at least, in your model, I wouldn't know how to do that</p>



<a name="173198660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173198660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173198660">(Aug 14 2019 at 12:43)</a>:</h4>
<p>E.g. If I have a <code>#[repr(C)] struct S(u16, u16)</code> and I want to insert 3 bytes of padding between both u16s, how would I do that ?</p>



<a name="173215922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173215922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173215922">(Aug 14 2019 at 15:56)</a>:</h4>
<blockquote>
<p>The ability for a user to say "at offset y there are N bytes of padding"</p>
</blockquote>
<p>I think that is a meaningless statement</p>



<a name="173215954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173215954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173215954">(Aug 14 2019 at 15:56)</a>:</h4>
<p>padding isnt a thing that exists in memory</p>



<a name="173216044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173216044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173216044">(Aug 14 2019 at 15:56)</a>:</h4>
<p>just like you cant say "there's a bool here" (in memory)</p>



<a name="173216108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173216108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173216108">(Aug 14 2019 at 15:56)</a>:</h4>
<p>or do you mean "at offset y in type T, ..." -- so, stating a property of the type, not some piece of data? in that case I proposed a definition that makes that work in some UCG issue</p>



<a name="173235138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235138">(Aug 14 2019 at 19:41)</a>:</h4>
<blockquote>
<p>or do you mean "at offset y in type T, ..."  </p>
</blockquote>
<p>that's what I meant</p>



<a name="173235301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235301">(Aug 14 2019 at 19:43)</a>:</h4>
<p>ideally, to state that property I'd write <code>#[repr(C)] struct S(u16, Pad, Pad, Pad, u16)</code> but that would mean that I need a <code>Pad</code> type that only contains padding</p>



<a name="173235409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235409">(Aug 14 2019 at 19:44)</a>:</h4>
<p>that would be a type that has only one value, but has, e.g.,  size 1</p>



<a name="173235445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235445">(Aug 14 2019 at 19:45)</a>:</h4>
<p>"contains only padding" is an ill-defined concept</p>



<a name="173235453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235453">(Aug 14 2019 at 19:45)</a>:</h4>
<p><code>Pad</code> is the same as <code>MaybeUninit&lt;u8&gt;</code></p>



<a name="173235461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235461">(Aug 14 2019 at 19:45)</a>:</h4>
<p>it is a byte that can have any value</p>



<a name="173235462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235462">(Aug 14 2019 at 19:45)</a>:</h4>
<p>not really</p>



<a name="173235474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235474">(Aug 14 2019 at 19:45)</a>:</h4>
<p>one must copy all bytes of a MaybeUninit&lt;u8&gt; on a typed copy</p>



<a name="173235479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235479">(Aug 14 2019 at 19:45)</a>:</h4>
<p>there is no reason to reify the concept of padding into the abstract machine</p>



<a name="173235488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235488">(Aug 14 2019 at 19:45)</a>:</h4>
<p>the whole point of pad would be not doing that</p>



<a name="173235499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235499">(Aug 14 2019 at 19:45)</a>:</h4>
<blockquote>
<p>one must copy all bytes of a MaybeUninit&lt;u8&gt; on a typed copy</p>
</blockquote>
<p>ah I see. but that is different from "contains only padding".</p>



<a name="173235550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235550">(Aug 14 2019 at 19:46)</a>:</h4>
<p>for that you want a type which has a trivial value representation but accepts any byte list</p>



<a name="173235552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235552">(Aug 14 2019 at 19:46)</a>:</h4>
<p>the libc crate is literally full of <code>_padding: u8</code></p>



<a name="173235555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235555">(Aug 14 2019 at 19:46)</a>:</h4>
<p>like, <code>()</code> of size &gt; 0</p>



<a name="173235564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235564">(Aug 14 2019 at 19:46)</a>:</h4>
<p>yeah</p>



<a name="173235577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235577">(Aug 14 2019 at 19:46)</a>:</h4>
<p>yes that is also easy to define in my framework</p>



<a name="173235610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235610">(Aug 14 2019 at 19:47)</a>:</h4>
<p>the type <code>Pad</code> is defined as:<br>
Value <code>Tuple([])</code> (the empty tuple) is related to any byte-list of length 1.<br>
end of definition.</p>



<a name="173235658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235658">(Aug 14 2019 at 19:47)</a>:</h4>
<p>this is a type that accepts any value (validity invariant is trivial) and where a typed copy transports no information (because it goes through <code>Tuple([])</code>, a singleton)</p>



<a name="173235742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235742">(Aug 14 2019 at 19:48)</a>:</h4>
<p>I finally understood what you mean by "contains only padding". it's not about the values it accepts / the validity invariant. it is about the behavior on a typed copy.</p>



<a name="173235760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235760">(Aug 14 2019 at 19:48)</a>:</h4>
<p>we currently doesn't really have a way to specify that in the language</p>



<a name="173235761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235761">(Aug 14 2019 at 19:48)</a>:</h4>
<p><code>Pad</code> and <code>MaybeUninit&lt;u8&gt;</code> have the same validity invariant</p>



<a name="173235770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235770">(Aug 14 2019 at 19:48)</a>:</h4>
<blockquote>
<p>we currently doesn't really have a way to specify that in the language</p>
</blockquote>
<p>well we do in the meta-language that we are speaking right now</p>



<a name="173235772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235772">(Aug 14 2019 at 19:49)</a>:</h4>
<p>but we dont in Rust, right</p>



<a name="173235775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235775">(Aug 14 2019 at 19:49)</a>:</h4>
<p>i guess that's what i meant with "a <code>MaybeUninit&lt;u8&gt;</code> that's always uninitialzied"</p>



<a name="173235795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235795">(Aug 14 2019 at 19:49)</a>:</h4>
<p>yeah. that wording tripped me because "is always X" sounds a lot like you want to change the validity invariant.</p>



<a name="173235802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235802">(Aug 14 2019 at 19:49)</a>:</h4>
<p>"a bool is always true or false"</p>



<a name="173235811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235811">(Aug 14 2019 at 19:49)</a>:</h4>
<p>so with such a Pad type, maybe we could improve some of the examples</p>



<a name="173235812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235812">(Aug 14 2019 at 19:49)</a>:</h4>
<p>but here this is not at all what you want so that wording was misleading</p>



<a name="173235820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235820">(Aug 14 2019 at 19:50)</a>:</h4>
<p>but now that we cleared this, we should write this down somewhere :D</p>



<a name="173235869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235869">(Aug 14 2019 at 19:50)</a>:</h4>
<p>e.g. if such a <code>Pad</code> type were present in libcore, we can write some examples as ... is equivalent to ... struct using Pad</p>



<a name="173235877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235877">(Aug 14 2019 at 19:50)</a>:</h4>
<p>yes</p>



<a name="173235885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235885">(Aug 14 2019 at 19:50)</a>:</h4>
<p>and then we don't talk about "padding" anymore</p>



<a name="173235888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235888">(Aug 14 2019 at 19:50)</a>:</h4>
<p>but about <code>Pad</code></p>



<a name="173235892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235892">(Aug 14 2019 at 19:50)</a>:</h4>
<p>we could add a section "padding" to the glossary, which does nothing but define that type?</p>



<a name="173235908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235908">(Aug 14 2019 at 19:51)</a>:</h4>
<p>that sounds like a good idea</p>



<a name="173235931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235931">(Aug 14 2019 at 19:51)</a>:</h4>
<p>and then we can basically use padding as synonym for <code>[Pad; N]</code></p>



<a name="173235941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235941">(Aug 14 2019 at 19:51)</a>:</h4>
<p>a union then always has a variant of type <code>[Pad; N]</code></p>



<a name="173235995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235995">(Aug 14 2019 at 19:52)</a>:</h4>
<p>why that?</p>



<a name="173235996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173235996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173235996">(Aug 14 2019 at 19:52)</a>:</h4>
<p>seems like this doesnt change anything</p>



<a name="173236003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236003">(Aug 14 2019 at 19:52)</a>:</h4>
<p>ah no, it is not necessary</p>



<a name="173236009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236009">(Aug 14 2019 at 19:52)</a>:</h4>
<p>its more like, a union uses two <code>[Pad; N]</code> (one before, one after the field) to fill each variant to the full size</p>



<a name="173236027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236027">(Aug 14 2019 at 19:52)</a>:</h4>
<p>we can just say that typed copies of union do not copy bytes at offsets where all variants have a Pad</p>



<a name="173236031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236031">(Aug 14 2019 at 19:52)</a>:</h4>
<p>i.e., what I had in my "picture"^^</p>



<a name="173236038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236038">(Aug 14 2019 at 19:53)</a>:</h4>
<p>yep</p>



<a name="173236047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236047">(Aug 14 2019 at 19:53)</a>:</h4>
<p>rules are the same</p>



<a name="173236052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236052">(Aug 14 2019 at 19:53)</a>:</h4>
<blockquote>
<p>we can just say that typed copies of union do not copy bytes at offsets where all variants have a Pad</p>
</blockquote>
<p>well here I'd slow down a bit, as that's a syntactic def.n</p>



<a name="173236084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236084">(Aug 14 2019 at 19:53)</a>:</h4>
<p>"where in this type is padding" would become a part of the ABI</p>



<a name="173236085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236085">(Aug 14 2019 at 19:53)</a>:</h4>
<p>isn't it equivalent to the one we have ?</p>



<a name="173236089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236089">(Aug 14 2019 at 19:53)</a>:</h4>
<p>and this is "interesting" for enums</p>



<a name="173236168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236168">(Aug 14 2019 at 19:54)</a>:</h4>
<p>like, <code>Result&lt;(u8, u16), (u16, u8)&gt;</code> has different padding depending on the active variant...</p>



<a name="173236180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236180">(Aug 14 2019 at 19:54)</a>:</h4>
<p>at least if you follow my typed copy rules</p>



<a name="173236192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236192">(Aug 14 2019 at 19:54)</a>:</h4>
<p>indeed</p>



<a name="173236234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236234">(Aug 14 2019 at 19:55)</a>:</h4>
<p>"where in this type is padding" is kind of already part of the type ABI</p>



<a name="173236245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236245">(Aug 14 2019 at 19:55)</a>:</h4>
<p>even if nothing there mentions padding</p>



<a name="173236278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236278">(Aug 14 2019 at 19:55)</a>:</h4>
<p>well... no I dont agree. it's pat of the value representation relation. but so far we didnt want to make that part of the ABI.</p>



<a name="173236432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236432">(Aug 14 2019 at 19:58)</a>:</h4>
<p>so i think the value relation is part of the ABI of the type</p>



<a name="173236491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236491">(Aug 14 2019 at 19:58)</a>:</h4>
<p>you can observe it</p>



<a name="173236503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236503">(Aug 14 2019 at 19:58)</a>:</h4>
<p>I dont think so. the representation relation is extremely language-specific. we don't want to have to sync that between Rust and C.</p>



<a name="173236505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236505">(Aug 14 2019 at 19:58)</a>:</h4>
<p>e.g. get a value of a type, inspect its bytes, move it around, and see which bytes don't change</p>



<a name="173236535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236535">(Aug 14 2019 at 19:59)</a>:</h4>
<p>so you can at least infer that some bytes are not part of the value relation of a type</p>



<a name="173236541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236541">(Aug 14 2019 at 19:59)</a>:</h4>
<p>but ultimately this is a rather arbitrary choice of terminology</p>



<a name="173236557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236557">(Aug 14 2019 at 19:59)</a>:</h4>
<p>due to how typed copies work on the type</p>



<a name="173236565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236565">(Aug 14 2019 at 19:59)</a>:</h4>
<p>what worries me more is how to define unions appropriately. it'll be really ugly and really sad :(</p>



<a name="173236635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236635">(Aug 14 2019 at 20:00)</a>:</h4>
<p>time to sleep :P</p>



<a name="173236652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding%20bytes%20def%20%23183/near/173236652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/padding.20bytes.20def.20.23183.html#173236652">(Aug 14 2019 at 20:00)</a>:</h4>
<p>;)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>